feat: XDG directory layout via VpDirs - #2346
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
b8069a5 to
2f8be03
Compare
08b7589 to
4e2abdf
Compare
|
@liangmiQwQ Your refactor needs to wait until this merge is completed first, as the changes are expected to be quite significant. |
78a23b6 to
a433ed4
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
6b26e69 to
ca9dcca
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ca9dcca689
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
IMO, I would be a little bit curious about the benefit for this move. The current For example, I help maintain the Vite+'s global package installations in several, I'm concerned that using I'm not against this direction, I just want to understand the motivation and the problem it solves. If it does help Vite+ improve, then now is really a good time to implement it (before RC). |
|
@liangmiQwQ Following the XDG directory convention will allow Vite+ to be more widely accepted, and many mature developer tools follow this convention, such as Claude Code and uv astral-sh/uv#8420 |
ca9dcca to
ad9d7dd
Compare
Capture the resolution design, grandfathering of existing ~/.vite-plus installs, installer alignment, and follow-ups for VP_HOME cleanup and migrate-on-upgrade.
Replace get_vp_home / the monolithic home module with VpDirs: category roots (bin, data, cache, config, state) come from an ordered resolution chain in dirs/resolution.rs (legacy Exist-gated grandfathering, VP_* and XDG Set overrides, then platform defaults), and first-level data subdirs (current, js_runtime, package_manager, packages, bins) are pure joins. Files and deeper trees stay with their features. Wire EnvConfig so test_guard/for_test_with_home isolate install roots without process-env leaks. Groundwork for voidzero-dev#827.
Switch global CLI, shims, js_runtime, package_manager, and related helpers off the old home path helpers onto VpDirs. Inject VP_BIN_DIR/VP_DATA_DIR/ VP_CACHE_DIR into JS children under the split layout; teach hooks and org-tarball to honor those roots. implode, env setup/doctor, and snapshot fixtures understand split vs legacy layouts without binary self-location (pin VP_HOME / isolated roots explicitly in tests).
Fresh installs land versions under the data dir and shims under the bin dir (XDG/platform defaults via VpDirs). install.sh, install.ps1, vp-setup, Dockerfile, trampoline, and install-global-cli follow the same resolution chain as the CLI; an existing ~/.vite-plus or explicit VP_HOME/--install-dir keeps the legacy monolithic root. Document the installer env surface (VP_HOME deprecated) and cover split plus legacy upgrade/implode paths in standalone install CI.
ad9d7dd to
5cc3b6c
Compare
Close #827
Summary
Centralize on-disk paths in
vp_shared::VpDirsand default fresh installs to the split XDG/platform layout. Existing default installs under~/.vite-plusremain on the legacy monolithic root for now (grandfathered via existence-gated resolution). Automatic layout migration is out of scope here and tracked as follow-up work.Resolution (high level)
Ordered sources (per category): deprecated
VP_HOME(custom full-root pin) → existing~/.vite-plus/./.vite-plus(exist-gated legacy mapping) →VP_BIN_DIR/VP_DATA_DIR/VP_CACHE_DIR→XDG_*→ platform defaults.~/.vite-plus)~/.local/bin<root>/bin~/.local/share/vite-plus<root>~/.cache/vite-plus<root>/cache~/.config/vite-plus<root>~/.local/state/vite-plus<root>Windows split uses
%LOCALAPPDATA%\vite-plus\{bin,data,cache,state}and%APPDATA%\vite-plusfor config. RelativeVP_*/XDG_*values are treated as unset.Commits (review order)
docs(rfc): document split directory layout via VpDirsrfcs/directory-layout.mddescribing the resolution chain, grandfathering, installer alignment, and follow-ups (VP_HOMEcleanup, migrate-on-upgrade).env-command.md) are left unchanged.feat(shared): introduce VpDirs with strategy-gated path resolutionget_vp_home/home.rswithVpDirs+dirs/resolution.rsstrategy chain.EnvConfig/ env vars so tests isolate layout viatest_guard/for_test_with_homewithout process-env leaks.AGENTS.mdpointer to the central path API.refactor: migrate call sites from get_vp_home to VpDirsjs_runtime, package manager, implode, env setup/doctor, and related helpers ontoVpDirs.VP_BIN_DIR/VP_DATA_DIR/VP_CACHE_DIRinto JS children when unset; hooks / org-tarball honor those roots.VpDirs).~/.vite-plusbeforebootstrap-cliso existing snapshot/e2e paths keep finding the global binary until layout cleanup lands.feat(install): default installers to the split XDG layoutinstall.sh/install.ps1/vp-setup/ trampoline / Dockerfile /install-global-clishare the same resolution chain as the CLI.~/.vite-plusor explicitVP_HOME/--install-dir→ legacy monolithic root.VP_HOMEdeprecated) and standalone-install CI coverage for split + legacy upgrade/implode.User impact
~/.vite-plusVP_HOME~/.local/binneeds to be on PATHFollow-up
VP_HOMEusage in the repo (especially PTY snapshot tests); preferVP_*_DIR/ XDGvp upgrade, migrate default~/.vite-pluscontents into splitVP_*_DIR/XDG_*/ platform dirs and remove the legacy rootTest plan
cargo check/ unit tests fordirsresolution and layout helpersVP_HOME/ disable shared seed where fakes are used)install.sh/install.ps1)install-global-clifor_test_with_homebin mappingtest-standalone-install(released + local split/legacy-upgrade jobs)~/.vite-plusstill works without moving